﻿using SqlSugar.Extensions;

namespace Jst.Core.Utility
{
    public class AppSettingsConstVars
    {
        #region 库配置
        public static readonly string DefaultConnection = AppSettingsHelper.GetContent("ConnectionStrings", "DefaultConnection");
        #endregion

        #region 是否执行数据库实体生成一次性任务
         public static readonly bool DbEntityGenerator = AppSettingsHelper.GetContent("configuration", "DbEntityGenerator").ObjToBool();
        #endregion

        #region Jwt授权配置
        public static readonly string JwtConfigSecretKey = AppSettingsHelper.GetContent("JwtConfig", "SecretKey");
        public static readonly string JwtConfigIssuer = AppSettingsHelper.GetContent("JwtConfig", "Issuer");
        public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience");
        public static readonly int Expires = AppSettingsHelper.GetContent("JwtConfig", "Expires").ObjToInt();
        public static readonly int RefreshExpires = AppSettingsHelper.GetContent("JwtConfig", "RefreshExpires").ObjToInt();
        #endregion

        #region redis
        public static readonly string RedisConfigConnectionString = AppSettingsHelper.GetContent("RedisConfig", "ConnectionString");
        public static readonly bool RedisUseCache = AppSettingsHelper.GetContent("RedisConfig", "UseCache").ObjToBool();
        public static readonly bool RedisUseTimedTask = AppSettingsHelper.GetContent("RedisConfig", "UseTimedTask").ObjToBool();
        #endregion

        #region Cors跨域设置
        public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName");
        public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjToBool();
        public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs");
        #endregion
    }
}
